package org.ndx.majick.properties.util;

import java.util.logging.Level;

/** 
 * Exception thrown when user tries to call {@link PropertiesFinder#getPropertiesFields(Class)} 
 * on an object implementing the Descriptable interface
 * 
 * @author Nicolas Delsaux
 *
 */
public class ForbiddenOnDescriptableException extends MajickPropertiesException {

	public ForbiddenOnDescriptableException(Class<? extends Object> beanClass) {
		super("tried to call PropertiesFinder#getPropertiesFields on a class implementing Descriptable : "+beanClass.getName());
		if(PropertyUtils.GOOD_PRACTICES.isLoggable(Level.WARNING)) {
			PropertyUtils.GOOD_PRACTICES.log(Level.WARNING, getMessage()
					+"\nThis can only occur due to user code calling by hand the aforementionned method, which is NOT a good thing."
					+"We (majick-properties developpers) suggest you to prefer to this the getProperties(Object) method.");
		}
	}
}
